<?php

function show_msg_exit($msg, $url = '')
{
    $msg = str_replace('\\', '\\\\', $msg);
    $url = str_replace('\\', '\\\\', $url);

    echo "<script>alert('$msg');";

    if ('' != $url) {
        echo "location.href='$url'";
    } else {
        echo 'history.back()';
    }

    echo '</script>';

    exit;
}

function is_login()
{
    if (!empty($_SESSION['is_login']) && $_SESSION['is_login'] === true) {
        return true;
    } else {
        return false;
    }
}
